package com.dudo.model;

public class DudoPlayerEvaluator {
	
	DudoPlayer player0, player1;

	public DudoPlayerEvaluator(DudoPlayer player0, DudoPlayer player1) {
		this.player0 = player0;
		this.player1 = player1;
	}
	
	public int[] getPlayerWins(int numTrials) {
		int[] wins = new int[2];
		/*for (int i = 0; i < numTrials; i++) {
			GameManager game = new GameManager();
			if (i % 2 == 0) {
				game.addPlayer(player0);
				game.addPlayer(player1);
				wins[game.play()]++;
			}
			else {
				game.addPlayer(player1);
				game.addPlayer(player0);
				wins[1 - game.play()]++;
			}
		}*/
		return wins;
	}

	public double[] getPlayerWinRates(int numTrials) {
		int[] wins = getPlayerWins(numTrials);
		double[] winRates = {(double) wins[0] / numTrials, (double) wins[1] / numTrials};
		return winRates;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(new DudoPlayerEvaluator(new SimpleDudoPlayer(), new JustDudoPlayer()).getPlayerWinRates(10000)[0]);
	}

}
